package megalopolis.client;

import megalopolis.net.Response;
import megalopolis.net.responses.MapUpdatedResponse;

/**
 * User: Kirill
 * Date: 19.03.2008
 */
public class ResponseHandler {

	private Controller controller;

	public ResponseHandler(Controller controller) {
		this.controller = controller;
	}

	public void handleResponse(Response response) {
		if (response instanceof MapUpdatedResponse) {
			handleMapUpdatedResponse((MapUpdatedResponse) response);
		}
	}

	private void handleMapUpdatedResponse(MapUpdatedResponse mapUpdatedResponse) {
		controller.applyObjects(mapUpdatedResponse.getGameObjects());
		controller.setPlayerMan(mapUpdatedResponse.getPlayerMan());
	}


}
